<template>
  <div class="box7">
    <div class="title">
      <p>年度游客量对比</p>
      <img src="../../images/dataScreen-title.png" alt="" />
    </div>
    <div ref="charts" class="charts"></div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'

//获取节点
const charts = ref()

onMounted(() => {
  //获取echarts类的实例
  const mycharts = echarts.init(charts.value)

  //设置实例的配置项
  mycharts.setOption({
    //布局组件
    grid: {
      left: 30,
      right: 20,
      top: 40,
      bottom: 20
      // containLabel: true
    },

    //标题组件
    title: {
      text: '散点图',
      textStyle: {
        color: 'white',
        fontSize: 15
      },
      left: '40%'
    },

    //X轴组件
    xAxis: {
      type: 'category'
      // show: false
    },
    //Y轴组件
    yAxis: {
      show: false
    },

    //系列组件：决定展示什么样的图形
    series: {
      type: 'scatter',
      data: [58, 33, 67, 20, 142, 62, 95, 18, 125, 66, 19, 80, 27, 115],
      symbol: 'diamod',
      symbolSize: 8,
      itemStyle: {
        color: 'red'
      },
      label: {
        show: true,
        position: 'top',
        color: 'yellow'
      }
    }
  })
})
</script>

<style lang="scss" scoped>
.box7 {
  width: 100%;
  height: 100%;
  background: url(../../images/dataScreen-main-cb.png) no-repeat;
  background-size: 100% 100%;

  .title {
    p {
      color: white;
      font-size: 20px;
    }
  }

  .charts {
    height: calc(100% - 50px);
  }
}
</style>
